package invocacionImplicita;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import orientacionObjetos.AppUsuario;


public class Formulario extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Formulario frame = new Formulario();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Formulario() {
		setTitle("Ejercicio 1: Invocaci\u00F3n impl\u00EDcita en interfaces gr\u00E1ficas");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 428, 114);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnPruebas = new JButton("Pruebas");
		btnPruebas.setBounds(71, 21, 89, 31);
		btnPruebas.addActionListener(new ActionListener() { 
			  public void actionPerformed(ActionEvent e) { 
				    selectionButtonPressedEv1();
				  } 
				} );
		btnPruebas.addActionListener(new ActionListener() { 
			  public void actionPerformed(ActionEvent e) { 
				    selectionButtonPressedEv2();
				  } 
				} );
		
		contentPane.add(btnPruebas);
		
		JButton btnPersistencia = new JButton("Persistencia");
		btnPersistencia.setBounds(211, 22, 113, 29);
		btnPersistencia.addActionListener(new ActionListener() { 
			  public void actionPerformed(ActionEvent e) { 
				    selectionButtonPressedEvPersistencia();
				  } 
				} );
		contentPane.add(btnPersistencia);
	}

	protected void selectionButtonPressedEv1() {
		// TODO Auto-generated method stub
		System.out.println("Salida del evento 1 por consola.");
		
	}
	protected void selectionButtonPressedEv2() {
		// TODO Auto-generated method stub
		System.out.println("Salida del evento 2 por consola.");
		
	}
	protected void selectionButtonPressedEvPersistencia() {
		// TODO Auto-generated method stub
		new AppUsuario().main(null);
		
	}
}
